package com.sinosoft.emplmis.collect.service;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.sinosoft.emplmis.collect.entity.UnemployedCollectEntity;
import com.sinosoft.emplmis.collect.manager.JoblessCollectManager;

public class JoblessCollectService {

	private JoblessCollectManager joblessCollectManager;

	public JoblessCollectManager getJoblessCollectManager() {
		return joblessCollectManager;
	}

	public void setJoblessCollectManager(JoblessCollectManager joblessCollectManager) {
		this.joblessCollectManager = joblessCollectManager;
	}
	
	/**
	 * 获取失业人员汇总信息（全区）
	 * @return
	 */
	public List<UnemployedCollectEntity> getJoblessCollectList(){
	    Logger.getRootLogger().info("获取失业人员全区汇总信息");
//		return joblessCollectManager.getJoblessCollectList();
	    
	    List<UnemployedCollectEntity> unemployedList = new ArrayList<UnemployedCollectEntity> ();
	    unemployedList = joblessCollectManager.getJoblessCollectList();
	    List<UnemployedCollectEntity> knryList = new ArrayList<UnemployedCollectEntity> ();
	    knryList = joblessCollectManager.getDifficultyCollectList();
//	    joblessList.addAll(knryList);
	    
	    List<UnemployedCollectEntity> joblessList = new ArrayList<UnemployedCollectEntity> ();
	    for(int i=0;i<unemployedList.size();i++){
	    	joblessList.add(unemployedList.get(i));
	    	joblessList.add(knryList.get(i));
	    }
	    
	    joblessList.add(joblessCollectManager.getJoblessCollectTotal().get(0));
	    joblessList.add(joblessCollectManager.getDifficultyCollectTotal().get(0));
	    	    
	    return joblessList;		
	}

	/**
	 * 获取失业人员汇总信息（街道）
	 * @return
	 */
	public List<UnemployedCollectEntity> getJoblessStreetList(String streetName,String streetId){
	    Logger.getRootLogger().info("获取失业人员街道汇总信息");
	    
	    List<UnemployedCollectEntity> unemployedList = new ArrayList<UnemployedCollectEntity> ();
	    unemployedList = joblessCollectManager.getJoblessStreetList(streetName,streetId);
	    List<UnemployedCollectEntity> knryList = new ArrayList<UnemployedCollectEntity> ();
	    knryList = joblessCollectManager.getDifficultyStreetList(streetName,streetId);
	    
	    List<UnemployedCollectEntity> joblessList = new ArrayList<UnemployedCollectEntity> ();
	    for(int i=0;i<unemployedList.size();i++){
	    	joblessList.add(unemployedList.get(i));
	    	joblessList.add(knryList.get(i));
	    }
	    
	    joblessList.add(joblessCollectManager.getJoblessStreetTotal(streetName,streetId).get(0));
	    joblessList.add(joblessCollectManager.getDifficultyStreetTotal(streetName,streetId).get(0));
	    	    
	    return joblessList;	
	}
	
	/**
	 * 获取失业人员汇总信息（街道）
	 * @return
	 */
	public List<UnemployedCollectEntity> getJoblessCommunityList(String communityName){
	    Logger.getRootLogger().info("获取失业人员街道汇总信息");
	    
	    List<UnemployedCollectEntity> unemployedList = new ArrayList<UnemployedCollectEntity> ();
	    unemployedList = joblessCollectManager.getJoblessCommunityList(communityName);
	    List<UnemployedCollectEntity> knryList = new ArrayList<UnemployedCollectEntity> ();
	    knryList = joblessCollectManager.getDifficultyCommunityList(communityName);
	    
	    List<UnemployedCollectEntity> joblessList = new ArrayList<UnemployedCollectEntity> ();
	    for(int i=0;i<unemployedList.size();i++){
	    	joblessList.add(unemployedList.get(i));
	    	joblessList.add(knryList.get(i));
	    }
	    	    
	    return joblessList;		
	}
	
}
